package com.pan.kang.demo.util;


import com.pan.kang.demo.res.BaseEnum;
import com.pan.kang.demo.res.Response;

public class ResultUtils {

    public static <T> Response<T> construct() {
        return new Response<T>();
    }

    public static <T> Response<T> construct(T data) {
        if (data instanceof BaseEnum) {
            BaseEnum baseEnum = (BaseEnum) data;
            return construct(baseEnum);
        }
        return new Response<T>(data);
    }

    public static <T> Response<T> construct(BaseEnum baseEnum) {
        return new Response<T>(baseEnum);
    }

    public static <T> Response<T> construct(Integer code, String message) {
        return new Response<T>(code,message);
    }

}
